using SqlSugar;

namespace EasyAdmin.Admin.Entity.Entities
{
    /// <summary>
    /// 用户和角色关联表
    /// </summary>
    [SugarTable("sys_user_role")]
    public class SysUserRole
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int UserId { get; set; }

        /// <summary>
        /// 角色ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true)]
        public int RoleId { get; set; }

        /// <summary>
        /// 导航属性 - 用户
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(UserId))]
        public SysUser User { get; set; }

        /// <summary>
        /// 导航属性 - 角色
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(RoleId))]
        public SysRole Role { get; set; }
    }
}